<?php

namespace App\Http\Controllers\home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;

class FootController extends Controller
{
     public function __construct(Request $request)
    {
        $userid = $request->input('userid');
        $userid = $request->input('userid');
        $row = DB::table('foot')->where('userid',$userid)->count();
        // dd($row);
        if ($row>14) {
            $rows = DB::table('foot')->where('userid',$userid)->orderBy('footid','desc')->get();
            $del = DB::table('foot')->where('userid',$userid)->where('footid','<',$rows[14]->footid)->delete();           # code...
        }
        
    }
    public function index(Request $request)
    {
    	$userid = ($request->session()->get('homeuser')->userid);
		$m=DB::table('foot')->where('userid',$userid)->orderBy('footid','desc')->get();	
		if ($userid>0) {
    		return view('home.foot.foot',['list'=>$m]);
    	}else{
    		 return view('home.car.carlogin');
    	}
    }
}
